﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using tracker.Models.DTO;
using tracker.Models.DAL;
using System.Text;

namespace tracker.Controllers
{
    public class HandlerGetAGroupAllUserAccountController : Controller
    {
        //
        // GET: /HandlerGetAGroupAllUserAccount/

        public string Index(String groupId)
        {
            StringBuilder result = new StringBuilder();
            result.Append("[");
            if (!String.IsNullOrEmpty(groupId))
            {
                List<EUserLogin> lstUser = new UserLoginDAL().getUserLoginByParentCode(groupId);
                
                if (lstUser != null)
                {

                    for (int i = 0; i < lstUser.Count; i++)
                    {
                        result.Append("['" + lstUser[i].Username + "','" + lstUser[i].Fullname + "']");
                        if (i < lstUser.Count - 1)
                        {
                            result.Append(",");
                        }
                    }
                }
            }
            result.Append("]");
            return result.ToString();
        }

    }
}
